<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>copy add content</title>
</head>
<body>
<article id="OR">
    这是待复制的内容
</article>

<script>
    window.onload = () => {
        document.addEventListener('copy',event => {
            event.clipboardData.setData("text", "hello，world")
        })
    }

    document.addEventListener('copy', function(e){
        // console.log(e.clipboardData.getData('text/plaintext'))
        // e.clipboardData.setData('text/plain', 'Hello, world!');
        e.clipboardData.setData('text/html', '<b>Hello, world!</b>');
        // console.log(e.clipboardData)
        // e.preventDefault(); // We want our data, not data from any selection, to be written to the clipboard
    });
</script>
</body>
</html>
